package com.duying.aid.dao;

import org.hibernate.Criteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;

import com.busi.framework.base.BaseDao;
import com.busi.framework.base.CC;
import com.duying.aid.model.DxTemplate;

public class DxTemplateDao  extends BaseDao{
	public Class getEntityClass(){
		return DxTemplate.class;
	}
	
	public DxTemplate getLastOne(){
		Criteria criteria = getSession().createCriteria(getEntityClass());
		criteria.add(Restrictions.eq("auditing" , CC.YES));
		criteria.addOrder(Order.desc("add_date"));
		criteria.setMaxResults(1);
		Object obj = criteria.uniqueResult();
		if(obj == null){
			return null;
		}else{
			return (DxTemplate)obj;
		}
	}


}